<?php

class Module_Impl_Category_Opration extends Module_Impl_Abstarct_Opration  {
	
	const FAIL_TO_UPDATE_BECAUSE_NO_EXIST = 'blog.category.update.fail.no.exist';
	const FAIL_TO_DELETE_BECAUSE_NO_EXIST = 'blog.category.delete.fail.no.exist';
	
	protected $_tablename = Config_Table::TABLE_BLOG_CATEGORY;	
	protected $_objectname = "Object_Blog_Category";
	
	protected $_check_field_before_insert = array(
				'user_id&name'=>'blog.category.new.fail.exist'
	          );
	          
	protected $_magic_field_count = array(
			'user_id'       =>array(
								'table' => Config_Table::TABLE_USER,
								'field' => 'categories_count',
								'step' => 1
		                       )
		);
		
	protected function __construct(){
		parent::__construct();	
		$this->_interface_select = Module_Impl_Category_Select::getInstance();
	}
	/**
	 * Singleton instance
	 * @var Module_Impl_Category_Opration
	 */
	protected static $_instance = null;
	/**
	 * Singleton instance 
	 * @return Module_Impl_Category_Opration
	 */
	public static function getInstance() {
		if (null === self::$_instance) {
			self::$_instance = new self ( );
		}
		return self::$_instance;
	}		
}